@extends('web.frame_layout')
<?php $parent_menu = "财务中心"; $menu_selected = "申请提现";?>
<link rel="stylesheet" href="{{asset('web/css/request-withdrawal.css')}}">
@section('content')
    <div class="m-right-nr">
        <div>
            <h2><span>{{$menu_selected}}</span></h2>
            <p>请选择提现方式：</p>
            <div class="m-choose-tx">
                <ul class="nav nav-tabs" role="tablist">
                    <li role="presentation" class="active">
                        <a href="#yhk" aria-controls="yhk" role="tab"
                           data-toggle="tab" class="yhk_type">银行卡</a>
                    </li>
                    <li role="presentation">
                        <a href="#zfb" aria-controls="zfb" role="tab" data-toggle="tab" class="zfb_type">支付宝</a>
                    </li>
                    <li role="presentation">
                        <a href="#wx" aria-controls="wx" role="tab" data-toggle="tab" class="wx_type">微信</a>
                    </li>
                </ul>
                <form class="changePW" id="changePW" action="{{ route('web.withdraw.act') }}" method="post"
                      autocomplete="on">
                    <input type="hidden" id="type" name="type" value="3">
                    <input name="_token" value="{{csrf_token()}}" type="hidden"/>
                    <div class="tab-content m-cart">
                        <div role="tabpanel" class="tab-pane active" id="yhk">
                            <ul>
                                <li>
                                    <label for="card_name" class="hidden-xs"><i>*</i>开户人姓名：</label>
                                    <input type="text" id="card_name" name="card_name" placeholder="请输入开户人姓名">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_bank" class="hidden-xs"><i>*</i>开户行：</label>
                                    <input type="text" id="card_bank" name="card_bank" placeholder="请输入开户行">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_no" class="hidden-xs"><i>*</i>银行卡号：</label>
                                    <input type="text" id="card_no" name="card_no" placeholder="">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_wallet" class="hidden-xs"><i>*</i>币种类型：</label>
                                    <select name="card_wallet" id="card_wallet">
                                        <option value="">请选择要提现的币种类型</option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_1}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_1)}}（{{ $wallet->w1 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_2}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_2)}} （{{ $wallet->w2 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_3}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_3)}} （{{ $wallet->w3 }}）
                                        </option>
                                        </option>
                                    </select>
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_money" class="hidden-xs"><i>*</i>提现金额：</label>
                                    <input type="text" id="card_money" name="card_money" placeholder="请输入提现金额">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_tel" class="hidden-xs"><i>*</i>手机号：</label>
                                    <input type="text" id="card_tel" name="card_tel" placeholder="请输入手机号">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="card_safepass" class="hidden-xs"><i>*</i>交易密码：</label>
                                    <input type="password" id="card_safepass" name="card_safepass"
                                           placeholder="请输入交易密码">
                                    <p class="u-ts"></p>
                                </li>
                                <li class="remarkLi">
                                    <label for="card_remark" class="hidden-xs">备注：</label>
                                    <textarea name="card_remark" id="card_remark"></textarea>
                                </li>
                                <li>
                                    <button>立即保存</button>
                                </li>
                            </ul>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="zfb">
                            <ul>
                                <li>
                                    <label for="alipay_no" class="hidden-xs"><i>*</i>支付宝帐号：</label>
                                    <input type="text" id="alipay_no" name="alipay_no" placeholder="请输入支付宝帐号">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="alipay_wallet" class="hidden-xs"><i>*</i>币种类型：</label>
                                    <select name="alipay_wallet" id="alipay_wallet">
                                        <option value="">请选择要提现的币种类型</option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_1}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_1)}}（{{ $wallet->w1 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_2}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_2)}} （{{ $wallet->w2 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_3}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_3)}} （{{ $wallet->w3 }}）
                                        </option>
                                    </select>
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="alipay_money" class="hidden-xs"><i>*</i>提现金额：</label>
                                    <input type="text" id="alipay_money" name="alipay_money" placeholder="请输入提现金额">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="alipay_tel" class="hidden-xs"><i>*</i>手机号：</label>
                                    <input type="text" id="alipay_tel" name="alipay_tel" placeholder="请输入手机号">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="alipay_safepass" class="hidden-xs"><i>*</i>交易密码：</label>
                                    <input type="password" id="alipay_safepass" name="alipay_safepass"
                                           placeholder="请输入交易密码">
                                    <p class="u-ts"></p>
                                </li>
                                <li class="remarkLi">
                                    <label for="alipay_remark" class="hidden-xs">备注：</label>
                                    <textarea name="alipay_remark" id="alipay_remark"></textarea>
                                </li>
                                <li>
                                    <button>立即保存</button>
                                </li>
                            </ul>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="wx">
                            <ul>
                                <li>
                                    <label for="wechat_no" class="hidden-xs"><i>*</i>微信账户：</label>
                                    <input type="text" id="wechat_no" name="wechat_no" placeholder="请输入微信帐号">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="wechat_wallet" class="hidden-xs"><i>*</i>币种类型：</label>
                                    <select name="wechat_wallet" id="wechat_wallet">
                                        <option value="">请选择要提现的币种类型</option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_1}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_1)}}（{{ $wallet->w1 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_2}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_2)}} （{{ $wallet->w2 }}）
                                        </option>
                                        <option value="{{\App\Models\MWallet::$WALLET_TYPE_3}}">
                                            {{uWalletStr(\App\Models\MWallet::$WALLET_TYPE_3)}} （{{ $wallet->w3 }}）
                                        </option>
                                    </select>
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="wechat_money" class="hidden-xs"><i>*</i>提现金额：</label>
                                    <input type="text" id="wechat_money" name="wechat_money" placeholder="请输入提现金额">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="wechat_tel" class="hidden-xs"><i>*</i>手机号：</label>
                                    <input type="text" id="wechat_tel" name="wechat_tel" placeholder="请输入手机号">
                                    <p class="u-ts"></p>
                                </li>
                                <li>
                                    <label for="wechat_safepass" class="hidden-xs"><i>*</i>交易密码：</label>
                                    <input type="password" id="wechat_safepass" name="wechat_safepass"
                                           placeholder="请输入交易密码">
                                    <p class="u-ts"></p>
                                </li>
                                <li class="remarkLi">
                                    <label for="wechat_remark" class="hidden-xs">备注：</label>
                                    <textarea name="wechat_remark" id="wechat_remark"></textarea>
                                </li>
                                <li>
                                    <button>立即保存</button>
                                </li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection

@section('footer')
    <script type="text/javascript">
        $('#changePW').validate({
            rules: {
                //银行卡验证
                card_name: {  //开户人
                    required: true,
                    maxlength: 5
                },
                card_no: {   //开户银行
                    required: true
                },
                card_bank: {  //银行卡号
                    required: true
                },
                card_wallet: {
                    required: true
                },
                card_money: {
                    required: true,
                    hundred: true
                },
                card_tel: {
                    required: true,
                    isMobile: true
                },
                card_safepass: {
                    required: true,
                    password: true
                },
                //支付宝验证

                alipay_no: {  //开户人
                    required: true
                },
                alipay_wallet: {  //开户人
                    required: true
                },
                alipay_money: {  //开户人
                    required: true,
                    hundred: true
                },
                alipay_tel: {  //开户人
                    required: true,
                    isMobile: true
                },
                alipay_safepass: {  //开户人
                    required: true,
                    password: true
                },

                //微信验证
                wechat_no: {  //开户人
                    required: true
                },
                wechat_wallet: {  //开户人
                    required: true
                },
                wechat_money: {  //开户人
                    required: true,
                    hundred: true
                },
                wechat_tel: {  //开户人
                    required: true,
                    isMobile: true
                },
                wechat_safepass: {  //开户人
                    required: true,
                    password: true
                }

            },
            messages: {
                wallet: {
                    required: "请选择钱包类型"
                }
            },
            errorPlacement: function (error, element) {
                $(element).siblings('.u-ts').html(error)
            },
            errorElement: 'span',
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    dataType: "json",
                    type: "post",
                    beforeSend: function () {
                        //禁用按钮,防止重复提交
                        $("button").attr('disabled', 'disabled')
                    },
                    success: function (data) {

                        if (data.code == 0) {
                            toastr["success"](data.msg);
                            setInterval(function () {
                                window.location = "{{route('web.withdraw.log')}}";
                            }, 2000)
                        } else {
                            $("button").removeAttr('disabled');
                            toastr["error"](data.msg);
                        }
                    }
                });
            }
        });
        $('.yhk_type').click(function () {

            $("#type").val("3");
        });
        $('.zfb_type').click(function () {

            $("#type").val("1");
        });
        $('.wx_type').click(function () {

            $("#type").val("2");
        });

        //    jQuery.validator.addMethod('password', function (value, element) {
        //        var password = /^[a-z0-9_-]{6,18}$/.test(value);
        //        return this.optional(element) || password
        //    }, '请输入6-18位字母，数字_-');
        //
        //    jQuery.validator.addMethod('select', function (value, element) {
        //        return this.optional(element) || (value !== '0')
        //    }, '请选择提现币种类型');
        //
        //    jQuery.validator.addMethod('banknum', function (value, element) {
        //        var num = /\d{15}|\d{19}/.test(value);
        //        return this.optional(element) || num
        //    }, '请输入正确银行卡号');
        //
        //    jQuery.validator.addMethod('telNum', function (value, element) {
        //        var phoneNum = /^[1][34578][\d]{9}$/.test(value);
        //        return this.optional(element) || phoneNum
        //    }, '请输入正确手机号');
    </script>

@endsection